package com.leyou.seckill.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.seckill.entity.TbSeckillPolicy;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 秒杀政策表 Mapper 接口
 * </p>
 *
 * @author HM
 */
public interface TbSeckillPolicyMapper extends BaseMapper<TbSeckillPolicy> {

    /**
     * 减库存
     * @param seckillId
     * @param num
     * @return
     */
    @Update("update tb_seckill_policy set stock_count = stock_count-#{num} where id=#{id}")
    int minusStock(@Param("id") Long seckillId,@Param("num") int num);
}
